﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace EyFramework.SocketServer.OutData
{
    public static class ReturnResult
    {
        public static string Success()
        {
            BaseOutData baseOut = new BaseOutData();
            baseOut.Success = true;
            baseOut.ErrorMessage = "";
            return JsonConvert.SerializeObject(baseOut);
        }

        public static string Success(object data)
        {
            BaseOutData baseOut = new BaseOutData();
            baseOut.Success = true;
            baseOut.Data = data;
            baseOut.ErrorMessage = "";
            return JsonConvert.SerializeObject(baseOut);
        }

        public static string Fail(string message)
        {
            BaseOutData baseOut = new BaseOutData();
            baseOut.Success = false;
            baseOut.ErrorMessage = message;
            return JsonConvert.SerializeObject(baseOut);
        }

        public static string Fail(string message, object data)
        {
            BaseOutData baseOut = new BaseOutData();
            baseOut.Success = false;
            baseOut.ErrorMessage = message;
            baseOut.Data = data;
            return JsonConvert.SerializeObject(baseOut);
        }
    }
}